package Day14;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class TransferPanel extends JPanel implements ActionListener {
    private ATM05 atm05;
    private JLabel transferAccountLabel = new JLabel("账号：");
    private JLabel transferMoneyLabel = new JLabel("金额：");
    private JTextField accountField = new JFormattedTextField();
    private JPasswordField moneyField = new JPasswordField();
    private Font font = new Font("宋体", Font.BOLD, 20);
    private JButton sureBtn = new JButton(new ImageIcon("Image/buttonSure.jpg"));

    public TransferPanel(ATM05 atm05) {
        this.atm05 = atm05;
        this.setLayout(null);
        this.setOpaque(false);

        transferAccountLabel.setBounds(300, 200, 80, 50);
        transferAccountLabel.setFont(font);
        this.add(transferAccountLabel);

        transferMoneyLabel.setBounds(300, 250, 80, 50);
        transferMoneyLabel.setFont(font);
        this.add(transferMoneyLabel);

        accountField.setBounds(380, 200, 250, 50);
        accountField.setFont(font);
        this.add(accountField);

        moneyField.setBounds(380, 250, 250, 50);
        moneyField.setFont(font);
        this.add(moneyField);

        sureBtn.setBounds(430, 320, 140, 50);
        sureBtn.addActionListener(this);
        this.add(sureBtn);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        atm05.showPanel("menu");
    }
}
